﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcmyjobs.Web.reward
{
    public partial class show_user : BasePage
    {
        lcmyjobs.BLL.user_basic bub = new BLL.user_basic();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.Title = string.Format("人才网   招聘网   求职网   猎头网   {0}—悬赏求职", Application["webname"].ToString());
                int id;
                if (Request.QueryString["bh"] != null)
                {
                    try
                    {
                        int bid = 0;
                        id = bub.FindIDByRBH(Request.QueryString["bh"].ToString());                        
                        int isself = 1;
                        this.lblID.Text = Request.QueryString["bh"].ToString();
                        show(id, bid, isself);
                    }
                    catch (Exception ex)
                    {

                        Maticsoft.Common.MessageBox.Show(this, "地址有错");
                    }
                }

            }

        }
        protected void show(int id, int eid, int isself)
        {
            
            DataSet ds = bub.GetUserResume(id, eid, isself);
            //            SELECT  [uid], [name], truename, sex, age, height, [address]6,huji, email, phone,onlinecontact, edu_name, school,eduyear, utype, workexpname15,jsname, jobtime, pay,[certificate], oldjobduty, honour, myvalution, vision23,dbo.fn_tradeSum(@uid) as trades,dbo.fn_jobSum(@uid) as jobs, dbo.fn_areaSum(@uid) as areas,yearpay,reward from Vresume where uid=@uid
            //select wunit,job,jobtime,tradename from Vuseroldjob where [uid]=@uid
            if (ds.Tables[0].Rows.Count > 0)
            {
                //this.lblID.Text = ds.Tables[0].Rows[0][0].ToString().PadLeft(6, '0');
                this.lblname.Text = ds.Tables[0].Rows[0][2].ToString();
                this.lblsex.Text = ds.Tables[0].Rows[0][3].ToString() + " | " + ds.Tables[0].Rows[0][4].ToString() + "岁 | " + ds.Tables[0].Rows[0][5].ToString() + "CM | 目前居住于" + ds.Tables[0].Rows[0][6].ToString();
                this.lblhuji.Text = "户籍：" + ds.Tables[0].Rows[0][7].ToString() + " | " + ds.Tables[0].Rows[0][15].ToString() + "工作经验";
                this.lblreward.Text = ds.Tables[0].Rows[0][28].ToString()+"元";
                this.lblvision.Text = ds.Tables[0].Rows[0][23].ToString();
                this.lbljobstates.Text = ds.Tables[0].Rows[0][16].ToString();
                this.lbltrade.Text = ds.Tables[0].Rows[0][24].ToString();
                this.lbljob.Text = ds.Tables[0].Rows[0][25].ToString();
                this.lblarea.Text = ds.Tables[0].Rows[0][26].ToString();
                this.lblpay.Text = ds.Tables[0].Rows[0][18].ToString();
                this.lbljobtime.Text = ds.Tables[0].Rows[0][17].ToString();
                //this.lbltype.Text = ds.Tables[0].Rows[0][14].ToString();
                this.lbledu.Text = "学历：" + ds.Tables[0].Rows[0][11].ToString() + " | 毕业学校：" + ds.Tables[0].Rows[0][12].ToString() + " | 毕业年份：" + ds.Tables[0].Rows[0][13].ToString() + " | 所学专业：" + ds.Tables[0].Rows[0][29].ToString();//专业
                if (ds.Tables[2].Rows.Count > 0)
                {
                    this.lbllanguage.Text = "";
                    for (int i = 0; i < ds.Tables[2].Rows.Count; i++)
                    {
                        if (ds.Tables[2].Rows[i][0].ToString() == "无")
                            this.lbllanguage.Text += ds.Tables[2].Rows[i][0].ToString() + "&nbsp;&nbsp;&nbsp;";
                        else
                            this.lbllanguage.Text += ds.Tables[2].Rows[i][0].ToString() + "：" + ds.Tables[2].Rows[i][1].ToString() + "&nbsp;&nbsp;&nbsp;";
                    }
                }
                this.lblskill.Text = ds.Tables[0].Rows[0][19].ToString();
                this.lblmyvalution.Text = ds.Tables[0].Rows[0][20].ToString();
                this.lblhonor.Text = ds.Tables[0].Rows[0][21].ToString();
                if (this.lblhonor.Text == "")
                {
                    this.lbl_yeji.Visible = false;
                }
                this.lbl1.Text = ds.Tables[0].Rows[0][22].ToString();
                this.lbllogintime.Text = ds.Tables[0].Rows[0]["logintime"].ToString();
            }
            if (ds.Tables[1].Rows.Count > 0)
            {
                Repeater1.DataSource = ds.Tables[1];
                Repeater1.DataBind();

            }

            if (ds.Tables[0].Rows[0]["utype"].ToString().Substring(0, 1) == "在")//如果是在校生
            {
                this.pnl_zwpj.Visible = true;
                this.pnl_gzjyyj.Visible = false;
            }
            else
            {
                this.pnl_zwpj.Visible = false;
                this.pnl_gzjyyj.Visible = true;
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string bh = Request.QueryString["bh"].ToString();
            Response.Redirect("offer_user.aspx?bh="+bh);
        }
    }
}